package com.wuzhishan.news.mapper;

import com.wuzhishan.news.pojo.BlogComment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface commentMapper {
    /**
     * 根据评论id，获取对应评论信息
     * @param pid
     * @return
     */
    BlogComment getCommentById(@Param("pid") String pid);

    /**
     * 添加评论
     * @param com
     */
    void addComment(BlogComment com);

    /**
     * 获取当前文章评论
     * @param articleId
     * @param pageIndex
     * @param pageSize
     * @return
     */
    List<BlogComment> selectPageComment(@Param("articleId") String articleId, @Param("pageIndex") Long pageIndex, @Param("pageSize") long pageSize);

    BlogComment selectCommentByTargetId(int target_id);

    int countsOfArticle(@Param("articleId") long articleId);
}
